'use strict';

const { Controller } = require('egg');



class noteController extends Controller {
  async getMes() {
    const { ctx } = this;
    let user_toekn = this.ctx.request.header.token;

    let decode = this.app.jwt.verify(user_toekn,this.app.config.jwt.secret);
    

    let userTwo = await this.app.model.User.findAll({where:{username : decode}});
    if(userTwo.length === 0){
      this.ctx.body = {
        code : 400,
        data : null
      }
    }

    let form = await this.app.model.Mes.findAll({where:{id : userTwo[0].id}});
    this.ctx.body = {
      code : 200,
      data : form
    }

  }


    

  
}

module.exports = noteController;
